﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jzy.Model.Project;
using Jzy.BLL.Project;
using System.Data;
using Frame.Lib.Utilities;


namespace Jzy.Web.Project.BugManage
{
    public partial class ChangeReceiver : PageEdit
    {
        private PrjBugBO _bug = new PrjBugBO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DispInfo();
            }
        }

        private void DispInfo()
        {
            PrjBugInfo info = _bug.GetInfo(PKID);

            ProjectBO prj = new ProjectBO();
            DataTable dt = prj.GetPrjMembers(info.PrjID.ToString());
            drpReceiveID.DataSource = dt.DefaultView;
            drpReceiveID.DataTextField = "UserName";
            drpReceiveID.DataValueField = "UserID";
            drpReceiveID.DataBind();
            drpReceiveID.SelectedValue = info.ReceiveID.ToString();


            txtRemark.Text = info.Remark;


        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            PrjBugInfo info = _bug.GetInfo(PKID);
            info.Remark = txtRemark.Text.Trim();

            info.ReceiveID = int.Parse(drpReceiveID.SelectedValue);
            info.ReceiveName = drpReceiveID.SelectedItem.Text;

            _bug.Save(info);

            JSUtil.RefreshView();
        }
    }
}
